package com.xntv.util;

/**
 * @author fy
 * @version 1.0
 * @date 2020/12/25
 */
public class ResultFactory {
    private final static int SUCCESS = 200;
    private final static int FAIL = 500;

    public static Result build(int code, String message, Object data) {
        return Result.builder()
                .code(code)
                .message(message)
                .data(data).build();
    }

    public static Result build(int code, String message) {
        return build(code, message, null);
    }

    public static Result fail(String message) {
        return build(FAIL, message);
    }

    public static Result fail(String message, Object data) {
        return build(FAIL, message, data);
    }

    public static Result success() {
        return build(SUCCESS, "success");
    }

    public static Result success(String message) {
        return build(SUCCESS, message);
    }

    public static Result success(String message, Object data) {
        return build(SUCCESS, message, data);
    }
}